const connection = require('../app/database');
const { md5Password } = require('../utils/password-encrypt');

class AddAdmin {
  async addAdmin(name, password) {
    password = md5Password(password)
    const statement = `
      INSERT INTO admin (name, password) VALUES (?, ?);
    `;
    const [result] = await connection.execute(statement, [name, password]);
    console.log('[addAdmin.service]新增管理员的操作------', result);
    return result;
  }
}

module.exports = new AddAdmin();